#include "cpoint.h"

CPoint::CPoint()
{
    x = 0;
    y = 0;
}

CPoint::CPoint(int x, int y)
{
    this->x = x;
    this->y = y;
}

CPoint::CPoint(CPoint *pOther)
{
    this->x = (*pOther).x;
    this->y = (*pOther).y;
}

CPoint::CPoint(const CPoint &rhs)
{
    this->x = rhs.x;
    this->y = rhs.y;
}

void CPoint::offset(int xOffset, int yOffset)
{
    this->x += xOffset;
    this->y += yOffset;
}

void CPoint::offset(const CPoint &rhs)
{
    this->x += rhs.x;
    this->y += rhs.y;
}

void CPoint::setPoint(int x, int y)
{
    this->x = x;
    this->y = y;
}

bool CPoint::operator ==(const CPoint &rhs) const
{
    return (this->x == rhs.x && this->y == rhs.y);
}

bool CPoint::operator !=(const CPoint &rhs) const
{
    return (this->x != rhs.x && this->y != rhs.y);
}

void CPoint::operator +=(const CPoint &rhs)
{
    this->x += rhs.x;
    this->y += rhs.y;
}

void CPoint::operator -=(const CPoint &rhs)
{
    this->x -= rhs.x;
    this->y -= rhs.y;
}

CPoint CPoint::operator +(const CPoint &rhs)
{
    CPoint point(this->x,this->y);
    point += rhs;
    return point;
}

CPoint CPoint::operator -(const CPoint &rhs)
{
    CPoint point(this->x,this->y);
    point -= rhs;
    return point;
}

